﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace KegMonitor
{
    public partial class Confirmation : Form
    {
        string _confirmationValue;

        public Confirmation()
        {
            InitializeComponent();

            this.Text = "Confirmation";
            this._confirmationValue = "YES";
            this.lblText.Text = "Are you sure that you'd like to complete this action?";
            this.lblConfirmation.Text = ConfirmationValueString;
            
        }

        public Confirmation(string title, string message)
        {
            InitializeComponent();

            this.Text = title;
            this._confirmationValue = "YES";
            this.lblText.Text = message;
            this.lblConfirmation.Text = ConfirmationValueString;
        }

        public Confirmation(string title, string message, string valueToType)
        {
            InitializeComponent();

            this.Text = title;
            this._confirmationValue = valueToType;
            this.lblText.Text = message;
            this.lblConfirmation.Text = ConfirmationValueString;
        }

        private string ConfirmationValueString
        {
            get
            {
                return   String.Format("Type \"{0}\" in the box below and hit \"Ok\", otherwise, hit \"Cancel.\"", _confirmationValue);
            }
        }

        private void txtConfirmation_TextChanged(object sender, EventArgs e)
        {
            if (txtConfirmation.Text == _confirmationValue)
            {
                btnOk.Enabled = true;
            }
            else
            {
                btnOk.Enabled = false;
            }
        }
    }
}
